Conversation
newpavlov
commented
Dec 10, 2025
| res if res > 0 => { | ||
| let len = usize::try_from(res).map_err(|_| Error::UNEXPECTED)?; | ||
| let (l, r) = buf.split_at_mut_checked(len).ok_or(Error::UNEXPECTED)?; | ||
| unsafe { sanitizer::unpoison(l) }; |
Member
Author
There was a problem hiding this comment.
Note that it applies unpoison to all users of sys_fill_exact. It's redundant in some cases (e.g. when we read from /dev/urandom), but AFAIK it has no negative consequences (outside of outlandish scenarios of misbehaving libc), while allowing to simplify the code a fair bit.
newpavlov
commented
Dec 10, 2025
| #[path = "../util_libc.rs"] | ||
| mod util_libc; | ||
| #[path = "../utils/get_errno.rs"] | ||
| mod utils; |
Member
Author
There was a problem hiding this comment.
We could move imports of errno_location for 4 targets which use this backends here, but I don't think it's worth the trouble since all 4 targets use different names.
dhardy
approved these changes
Dec 27, 2025
Member
dhardy
left a comment
There was a problem hiding this comment.
LGTM, esp. the changes to get_errno.
takumi-earth
pushed a commit
to earthlings-dev/getrandom
that referenced
this pull request
Jan 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR refactors
util_libc,sanitizer, andlazymodules. The modules are moved into theutilsdirectory and "mounted" with#[path = ".."]. With this change all uses of#[path = ".."]point towards theutilsdirectory.